package com.game.euchre;
import java.util.Random; 
import java.util.ArrayList;

public class Dealer {
	    public static ArrayList<Card> cards;   
	    private Card[] hand;
	    private Card[] kitty;
	    
	    
	    public Dealer()
	    {
	    	Trump changeDealer = new Trump();
	    	
	    	// iterates the dealers
	    	int currentDealer = new Trump().dealerLocation;
	    	changeDealer.currentDealer(currentDealer);
	    	
	        cards = new ArrayList<Card>();
	        for (int a=0; a<=3; a++)
	        {
	            for (int b=0; b<=5; b++)
	             {
	            	int c = 0;
	            	int d = 0;
	            	cards.add( new Card(a,b,c, d) );
	            	d ++;
	             }
	        }
	       // Shuffling();
	    }
	    
	    public void Shuffling() {
	    	   
	        for (int i=0; i<100; i++)
  	        {
	        	Random generator = new Random();
	            int index_1 = generator.nextInt( cards.size() - 1 );
	            int index_2 = generator.nextInt( cards.size() - 1 );
	 
	            Card temp = (Card) cards.get( index_2 );
	            cards.set( index_2 , cards.get( index_1 ) );
	            cards.set( index_1, temp );
	        }
	        
	    }
	 
	    public Card drawFromDeck()
	    {
	        return cards.remove(0);
	    }
	 
	    // how many cards are left do we need?
	    public int getTotalCards()
	    {
	        return cards.size();
	    }
	    
	    public Card[] kitty()
	    {
	    	kitty = new Card[4];
	    	int x;
	    	for (x=0; x<4; x++)
	    	{
	    		kitty[x] = drawFromDeck();
	    	}
	    	
	    	return kitty;
	    }

	    public Card[] hand()
	     {
	        hand = new Card[5];
	        int x;
	        
	        // Hand
	        for (x = 0; x<5; x++)
	        {
	          hand[x] = drawFromDeck();
	        }
	        
	        return hand;
	        //WE NEED THIS
	        /*Card card1 = hand1[0];
	        card1.getRank();
	        card1.getSuit();*/

	     }

	    void displayAll()
	      {
	         for (int x=0; x<5; x++)
	         System.out.println(hand[x]); //calls cards[x].toString()
	      }
	} 
